<template>
  <div id="addPraise">
    <el-dialog
      title="增加点赞数"
      :visible.sync="addPraiseData.isShow"
      width="30%"
    >
      <div class="input-num-box">
        <span class="red-text">*</span>
        <span class="praise-num">{{ addPraiseData.likeCount }}</span>
        <el-input-number
          v-model="praiseNum"
          :min="1"
          label="描述文字"
          @change="handleChange"
        ></el-input-number>
      </div>
      <span slot="footer" class="dialog-footer">
        <el-button @click="addPraiseData.isShow = false">取 消</el-button>
        <el-button type="success" @click="addPraise">确 定</el-button>
      </span>
    </el-dialog>
  </div>
</template>
<script>
import { addPraiseAPI } from '@/api/commentCheck/lifeCommentCheck' // 接口
export default {
  props: ['addPraiseData'],
  data() {
    return {
      praiseNum: '',
      commentId: ''
    }
  },
  mounted() {
    this.commentId = this.addPraiseData.commentId
  },
  methods: {
    handleChange(num) {},
    addPraise() {
      let params = {
        count: this.praiseNum
      }
      addPraiseAPI(
        this.commentId,
        params,
        (response) => {
          this.$emit('refresh')
          this.addPraiseData.isShow = false
        },
        (response) => {
          this.$message({
            message: response.message,
            type: 'warning'
          })
        }
      )
    }
  }
}
</script>
<style lang="less" scoped>
#addPraise {
  .input-num-box {
    text-align: center;
  }
  .red-text {
    color: red;
  }
  .praise-num {
    margin-left: 5px;
    margin-right: 10px;
  }
}
</style>
